#!/bin/bash

VERSION="1.0.0"
cd `dirname $0`/..
mkdir -p DISTR
cd DISTR
echo "svn checkout ..."
svn checkout svn://localhost/Infra/trunk/OpenArs OpenArs
find OpenArs -type d -name ".svn" -exec rm -rf {} \;

CORE_FILES="OpenArs/READMY
	OpenArs/READMY_RU
	OpenArs/READMY.CORE
	OpenArs/tools/logs
	OpenArs/tools/check_conf.sh
	OpenArs/tools/log_parser.pl 
	OpenArs/tools/init_ssh.sh
	OpenArs/tools/scripts_info.sh
	OpenArs/tools/make_sshkey.sh
	OpenArs/tools/svn2work.sh
	OpenArs/tools/work2svn.sh
	OpenArs/conf/hosts.xml
	OpenArs/conf/users.xml
	OpenArs/conf/main.xml
	OpenArs/conf/scripts.xml
	OpenArs/logs
	OpenArs/misc
	OpenArs/data/hosts.sql
	OpenArs/notification/clear_log.pl
	OpenArs/notification/send_mail.sh
	OpenArs/notification/log_parser.pl
	OpenArs/scripts/check_dns.sh
	OpenArs/scripts/check_key.sh
	OpenArs/common/conf.h
	OpenArs/common/debug.h
	OpenArs/common/functions.h
	OpenArs/setup.sh"

ZABBIX_MANAGER_FILES="OpenArs/READMY.ZABBIX-MANAGER
	OpenArs/data/zabbix-manager.sql
	OpenArs/scripts/zabbix_manager/check_config_crc.sh
	OpenArs/scripts/zabbix_manager/check_scripts_crc.sh
	OpenArs/scripts/zabbix_manager/input/configs2install
	OpenArs/scripts/zabbix_manager/input/scripts2install
	OpenArs/scripts/zabbix_manager/input/srvlist.lst
	OpenArs/scripts/zabbix_manager/install_config.sh
	OpenArs/scripts/zabbix_manager/install_script.sh
	OpenArs/scripts/zabbix_manager/make_config.sh"

SERVERS_INFO_FILES="OpenArs/READMY.SERVERS-INFO
	OpenArs/data/servers-info.sql
	OpenArs/scripts/servers_info/get_df_info.sh
	OpenArs/scripts/servers_info/get_hdd_info.sh
	OpenArs/scripts/servers_info/get_users_info.sh
	OpenArs/scripts/servers_info/local.hdd.sh"

SECURE_FILES="OpenArs/READMY.SECURE
	OpenArs/data/secure.sql"
	
tar -cf openars.monitoring.core.$VERSION.tar $CORE_FILES
tar -cf openars.monitoring.zabbix-manager.$VERSION.tar $ZABBIX_MANAGER_FILES
tar -cf openars.monitoring.servers-info.$VERSION.tar $SERVERS_INFO_FILES
tar -cf openars.monitoring.secure.$VERSION.tar $SECURE_FILES

rm -rf OpenArs

